import configparser

config=configparser.ConfigParser()
config.read('test.ini')

#获取sections
print(config.sections())

#获取某一section下所有的options
print(config.options('section1'))#获取选项(左边的键值对)

#获取对应的值，item
print(config.items('section1'))

#获取指定的值
res=config.get('section1','user')
print(res,type(res))
res=config.get('section1','age')
print(int(res),type(res))

#获取bool值
res=config.getboolean('section1','is_admin')
print(res,type(res))

res=config.getfloat('section1','salary')
print(res)

res=config.getint('section1','salary')
print(res)
